package cn.edu.cqut.test0430;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
import java.util.Scanner;

public class Test1 {
	public static void main(String[] args) throws Exception {
//		File file = new File("F:\\src\\0307\\Test\\src\\cn\\edu\\cqut\\t0430\\Test1.java");
//		System.out.println(file.exists());
//		System.out.println(file.length());
//		Writer writer = new FileWriter(file);
		Scanner scanner = new Scanner(System.in);
//		while(true)
//		{
//			String str = scanner.nextLine();
//			if(str.equalsIgnoreCase("exit"))
//				break;
//			writer.write(str+"\n");
//		}
//		scanner.close();
//		writer.close();
		//======================================
//		scanner = new Scanner(file);
//		while(scanner.hasNext())
//		{
//			String str = scanner.nextLine();
//			System.out.println(str);
//		}
//		scanner.close();
		
//		Reader reader = new FileReader(file);
//		char[] data = new char[1024];
//		int len = -1;
//		while((len=reader.read(data, 0, data.length))!=-1)
//		{
//			String str = new String(data,0,len);
//			System.out.println(str);
//		}
//		reader.close();
		
		URL url = new URL("https://www.jd.com/");
		scanner = new Scanner(url.openStream());
		while(scanner.hasNext())
		{
			String str = scanner.nextLine();
			System.out.println(str);
		}
		scanner.close();
	}
}
